package com.whfc.ms.api.emp.service.impl;

import com.whfc.common.result.ListData;
import com.whfc.common.result.PageData;
import com.whfc.emp.dto.AppFaceGateConfigDTO;
import com.whfc.emp.dto.AppFaceGateDTO;
import com.whfc.emp.dto.AppFaceGateEmpDTO;
import com.whfc.emp.dto.AppFaceGatePlatformDTO;
import com.whfc.emp.param.AppFacaGateEditParam;
import com.whfc.emp.param.AppFaceGateAddParam;
import com.whfc.emp.param.AppFaceGateGrantEmpParam;
import com.whfc.emp.service.AppFaceGateService;
import com.whfc.ms.api.emp.service.MsAppFaceGateService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClasssName MsAppFaceGateServiceImpl
 * @Description 闸机管理
 * @Author hw
 * @Date 2021/1/4 11:45
 * @Version 1.0
 */
@Service
public class MsAppFaceGateServiceImpl implements MsAppFaceGateService {

    @DubboReference(interfaceClass = AppFaceGateService.class, version = "1.0.0")
    private AppFaceGateService appFaceGateService;

    @Override
    public ListData<AppFaceGateDTO> list(Integer deptId, String keyword) {
        List<AppFaceGateDTO> list = appFaceGateService.list(deptId, keyword);
        return new ListData<>(list);
    }

    @Override
    public void add(AppFaceGateAddParam request) {
        appFaceGateService.add(request);
    }

    @Override
    public void edit(AppFacaGateEditParam request) {
        appFaceGateService.edit(request);
    }

    @Override
    public void del(Integer faceGateId) {
        appFaceGateService.del(faceGateId);
    }

    @Override
    public PageData<AppFaceGateEmpDTO> empList(Integer faceGateId, String keyword, Integer groupId, Integer workTypeId, Integer type, Integer pageNum, Integer pageSize) {
        return appFaceGateService.empList(faceGateId, keyword, groupId, type, workTypeId, pageNum, pageSize);
    }

    @Override
    public PageData<AppFaceGateEmpDTO> unGrantEmpList(Integer deptId, Integer faceGateId, Integer groupId, String keyword, Integer pageNum, Integer pageSize) {
        return appFaceGateService.unGrantEmpList(deptId, faceGateId, groupId, keyword, pageNum, pageSize);
    }

    @Override
    public void faceGateGrantEmp(AppFaceGateGrantEmpParam request) {
        appFaceGateService.faceGateGrantEmp(request);
    }

    @Override
    public void faceGateRevokeEmp(AppFaceGateGrantEmpParam request) {
        appFaceGateService.faceGateRevokeEmp(request);
    }

    @Override
    public String deviceAuthorizationCancel(String deviceKey, String personGuid) {
        return appFaceGateService.deviceAuthorizationCancel(deviceKey, personGuid);
    }

    @Override
    public void sync(Integer faceGateId) {
        appFaceGateService.sync(faceGateId);
    }

    @Override
    public List<AppFaceGateConfigDTO> getFaceGateConfigList(Integer deptId) {
        return appFaceGateService.getFaceGateAppList(deptId);
    }

    @Override
    public List<AppFaceGatePlatformDTO> getFaceGatePlatformList() {
        return appFaceGateService.getAllFaceGatePlatform();
    }

    @Override
    public void openDoor(Integer faceGateId) {
        appFaceGateService.openDoor(faceGateId);
    }

    @Override
    public PageData<AppFaceGateEmpDTO> failList(Integer faceGateId, Integer groupId, String keyword, Integer pageNum, Integer pageSize) {
        return appFaceGateService.failEmpList(faceGateId, keyword, groupId, pageNum, pageSize);
    }
}
